package com.siha_back.mapper;

import com.siha_back.entity.dto.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

@Mapper
public interface UserMapper {
    //根据用户名查询用户
    @Select("select user.*,major.major_name from user join major on user.majorId=major.id where email=#{email}")
    User findByUserName(String username);


    //注册
    @Insert("insert into user(username,password,avatar,majorId,phone,email)" +
            " values(#{username},#{password},#{avatar},#{majorId},#{phone},#{email})")
    void add(User user);
//
//    @Update("update user set password=#{password},age=#{age},phone=#{phone},email=#{email} where id=#{id}")
//    void update(User user);
//    @Update("update user set password=#{newPwd} where id=#{id}")
//    void updatePwd(@Param("newPwd") String newPwd,@Param("id") Integer id);
}
